//package com.yupi.springbootinit.mq;
//
//import com.yupi.springbootinit.config.RabbitMqConfig;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
//import java.nio.charset.StandardCharsets;
//
//@Component
//public class MessageListeners {
//    private static final Logger log = LoggerFactory.getLogger(MessageListeners.class);
//
//    // @RabbitListener(queues = RabbitMqConfig.QUEUE_MSG_IMMEDIATE)  // RabbitMQ 已暂停使用
//    public void onImmediate(Object payload, Message raw) {
//        String rk = raw.getMessageProperties().getReceivedRoutingKey();
//        String body = new String(raw.getBody(), StandardCharsets.UTF_8);
//        log.info("[IMMEDIATE] rk={}, body={}", rk, body);
//    }
//
//    // @RabbitListener(queues = RabbitMqConfig.QUEUE_REMINDER_UNCLAIMED)  // RabbitMQ 已暂停使用
//    public void onUnclaimed(Object payload, Message raw) {
//        String rk = raw.getMessageProperties().getReceivedRoutingKey();
//        String body = new String(raw.getBody(), StandardCharsets.UTF_8);
//        log.info("[REMINDER-UNCLAIMED] rk={}, body={}", rk, body);
//    }
//
//    // @RabbitListener(queues = RabbitMqConfig.QUEUE_DLQ)  // RabbitMQ 已暂停使用
//    public void onDlq(Message raw) {
//        String rk = raw.getMessageProperties().getReceivedRoutingKey();
//        String body = new String(raw.getBody(), StandardCharsets.UTF_8);
//        log.error("[DLQ] rk={}, headers={}, body={}", rk, raw.getMessageProperties().getHeaders(), body);
//    }
//}